package cn.wolfcode.trip.api.controller;

import cn.wolfcode.trip.base.domain.StrategyDetail;
import cn.wolfcode.trip.base.query.QueryObject;
import cn.wolfcode.trip.base.service.IStrategyDetailService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Copyright: Copyright (c) 2019 Super520
 * 描述：攻略文章控制器
 *
 * @package: cn.wolfcode.trip.api.controller
 * @author: Patch
 * @date: 2019/5/27 10:44
 * 总结:
 */
@RestController
@RequestMapping("strategyDetails")
public class StrategyDetailController {

    @Autowired
    private IStrategyDetailService detailService;
    /**
     * 根据文章id查询文章对象
     * 1.资源 /strategyDetails/{id}
     * 2.请求方式
     * 3.请求参数
     * 4.返回结果 StrategyDetail
     */
    @GetMapping("{id}")
    public StrategyDetail getById(@PathVariable Long id){
        return  detailService.getById(id);
    }

    /**
     * 查询攻略文章
     * 1.资源 /strategyDetails
     * 2.请求方式 get
     * 3.请求参数 qo
     * 4.返回结果 pageInfo
     */
    @GetMapping
    public PageInfo list(QueryObject qo){
        return detailService.listContentByKeyword(qo);
    }

}
